﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FXnaInfrastructure
{
    
    [Serializable]
    public  class IDGenerator
    {
        public IDGenerator()
        {
            this._idIndex = 0;
            this._preFix = "";

        }

        public IDGenerator(int index, string prefix)
        {
            this._idIndex = index;
            this._preFix = prefix;
        }


        string _preFix;

        /// <summary>
        /// 前缀
        /// </summary>
        public string PreFix
        {
            get { return _preFix; }
            set { _preFix = value; }
        }


        int _idIndex;



        /// <summary>
        /// 取得下一个ID值
        /// </summary>
        /// <returns></returns>
        public string GetNextId()
        {

            this._idIndex=this._idIndex+1;

            return this._preFix + this._idIndex.ToString();
 

        }

        public int GetNextIndex()
        {
            this._idIndex = this._idIndex + 1;

            return this._idIndex;
 
        }



    }
}
